<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\GridView;
use yii\bootstrap\Modal;
use common\helpers\StringHelper;
/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var common\models\search\PostSearch $searchModel
 */

$this->title = 'Posts';
$this->params['breadcrumbs'][] = $this->title;
$content = "我们都有一个家，名字叫中国，兄弟姐妹都很多，景色也不错。家里藏着2条龙，是长江与黄河，还有珠穆朗玛峰和青藏高原，那就是青草高原。";
echo StringHelper::truncate_utf8_string($content,2000); //不显示省略号
echo Html::a('创建', '#', [
  'id' => 'create',
  'data-toggle' => 'modal',
  'data-target' => '#create-modal',
  'class' => 'btn btn-success',
]);
?>
<?php
Modal::begin([
  'id' => 'create-modal',
  'header' => '<h4 class="modal-title">创建sssswqeeqweqw</h4>',
  'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl = Url::toRoute('indexs');
$js = <<<JS
$.get('{$requestUrl}', {},
function (data) {
$('.modal-body').html(data);
}
);
JS;
$this->registerJs($js);
Modal::end();
?>
<div class="post-index">

   <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'thread_id',
            'user_id',
            'user_name',
            'title',
            // 'body:ntext',
            // 'create_time',
            // 'modify_time',
            // 'supports',
            // 'againsts',
            // 'floor',
            // 'note',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
